package com.fast.common.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ApplicationUtil {

	public static Logger logger = LoggerFactory.getLogger(ApplicationUtil.class);

	private static Properties prop = null;
	
	static {
		prop = new Properties();
		InputStream fos = Thread.currentThread().getContextClassLoader()
				.getResourceAsStream("META-INF/application.properties");
		try {
			prop.load(fos);
		} catch (IOException e) {
			logger.error("", e);
		}
	}

	public static String getValue(String key) {
		if (prop == null) {
			return null;
		}
		return StringUtils.trimToEmpty(prop.getProperty(key));
	}

}
